<?php 
namespace struggle\libraries\core;


class View{
    private $itsBasePath = '';
    private $itsSuffix   = 'htm';
    private $itsTheme    = 'default';
    //private 
    
    public function __construct(){
        $this->itsBasePath = APP_THEME;
        \struggle\C('VIEW_BASE_PATH') && $this->itsBasePath = \struggle\C('VIEW_BASE_PATH');
        \struggle\C('VIEW_SUFFIX')    && $this->itsSuffix   = \struggle\C('VIEW_SUFFIX');
        \struggle\C('VIEW_THEME')     && $this->itsTheme    = \struggle\C('VIEW_THEME');
        
    }
    
    /**
     * 渲染模板
     */
    public function render($sRenderFile = ''){
        if (is_file($sRenderFile)){
            //
        }
        $sBasePath = '';
        if ($sDotPos = strpos($sRenderFile, '.')){
            $sPrefix = substr($sRenderFile, 0, $sDotPos);
            $sRenderFile = substr($sRenderFile, $sDotPos+1);
            if ($sPrefix == 'struggle' && $this->itsBasePath != THEME_PATH){
                $this->itsBasePath = THEME_PATH;
            }
        }
        if ($sRenderFile){
           echo $sRenderFile;
        }
    }
    
    
}



